﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using MathDLL;//引用动态链接库;VB语言编写的动态链接库

namespace _00_调用_委托_非委托_动态链接库
{
    internal class Program
    {
        static void Main(string[] args)
        {
            MathDLL.Math math = new MathDLL.Math();

            Console.WriteLine("{0}+{1}={2}",1,2,math.Add(1, 2));
            Console.WriteLine("{0}-{1}={2}", 1, 2, math.Subtract(1, 2));
            Console.WriteLine("{0}*{1}={2}", 1, 2, math.Multiply(1, 2));
            Console.WriteLine("{0}/{1}={2}", 4, 2, math.Divide(4, 2));

            Console.WriteLine("=========================================");

            Console.WriteLine("{0}+{1}={2}", 1, 2, Add(1, 2));
            Console.WriteLine("{0}-{1}={2}", 1, 2, Sub(1, 2));
            Console.WriteLine("{0}*{1}={2}", 1, 2, Mul(1, 2));
            Console.WriteLine("{0}/{1}={2}", 4, 2, Div(4, 2));


            Console.ReadKey();
        }

        [DllImport("C:\\Users\\Administrator\\source\\repos2\\4_2_委托_事件_多线程\\x64\\Debug\\MyMathDll.dll")]
        public extern static int Add(int a, int b);

        [DllImport("C:\\Users\\Administrator\\source\\repos2\\4_2_委托_事件_多线程\\x64\\Debug\\MyMathDll.dll")]
        public extern static int Sub(int a, int b);

        [DllImport("C:\\Users\\Administrator\\source\\repos2\\4_2_委托_事件_多线程\\x64\\Debug\\MyMathDll.dll")]
        public extern static int Mul(int a, int b);

        [DllImport("C:\\Users\\Administrator\\source\\repos2\\4_2_委托_事件_多线程\\x64\\Debug\\MyMathDll.dll")]
        public extern static int Div(int a, int b);



    }
}
